package service;

import dao.UserDao;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
  //注入dao
    @Autowired
    private UserDao userDao;

    public void addUser(User user){
        userDao.add(user);
    }

    public void deleteUser(int id){
      userDao.delete(id);
    }

    public void updateUser(User user){
      userDao.update(user);
    }

    public void findCount(){
      userDao.selectCount();
    }

    public User queryUser(int id){
      return userDao.query(id);
    }

    public List<User> queryUserList(){
      return userDao.queryList();
    }

    public void batchAdd(List<Object[]> batchArgs){
       userDao.batchAddUsers(batchArgs);
    }

    public void batchUpdate(List<Object[]> batchArgs){
      userDao.batchUpdateUser(batchArgs);
    }

  public void batchDelete(List<Object[]> batchArgs){
    userDao.batchDeleteUser(batchArgs);
  }
}
